home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Internet Surfer: Getting Started
/
Internet Surfer - Getting Started (Wayzata Technology)(7231)(1995).bin
/
pc
/
mac
/
bonus
/
peter_le
/
talk_sou
/
my_libra
/
mybutton.uni
< prev
next >
Wrap
Text File
|
1992-04-20
|
2KB
|
75 lines
unit MyButtons;
{ This program was written by Peter N Lewis, Mar 1992 in THINK Pascal 4.0.1 }
interface
procedure GrayButton (dlg: dialogPtr; item: integer);
procedure UngrayButton (dlg: dialogPtr; item: integer);
procedure UpdateButton (dlg: dialogPtr; item: integer; active: boolean);
procedure InitButton (dlg: dialogPtr; item: integer; var active: boolean; new: boolean);
procedure SetButton (dlg: dialogPtr; item: integer; var active: boolean; new: boolean);
implementation
procedure GrayButton (dlg: dialogPtr; item: integer);
var
kind: integer;
h: handle;
r: rect;
ps: PenState;
begin
GetDItem(dlg, item, kind, h, r);
InsetRect(r, 4, 2);
GetPenState(ps);
PenPat(gray);
PenMode(patBic);
PaintRoundRect(r, 3, 3);
SetPenState(ps);
end;
procedure UngrayButton (dlg: dialogPtr; item: integer);
var
kind: integer;
h: handle;
r: rect;
begin
GetDItem(dlg, item, kind, h, r);
Draw1Control(controlHandle(h));
end;
procedure UpdateButton (dlg: dialogPtr; item: integer; active: boolean);
begin
if not active then
GrayButton(dlg, item);
end;
procedure InitButton (dlg: dialogPtr; item: integer; var active: boolean; new: boolean);
var
kind: integer;
h: handle;
r: rect;
ps: PenState;
begin
active := new;
GetDItem(dlg, item, kind, h, r);
if active then
HiliteControl(controlHandle(h), 0)
else begin
HiliteControl(controlHandle(h), 255);
GrayButton(dlg, item);
end;
end;
procedure SetButton (dlg: dialogPtr; item: integer; var active: boolean; new: boolean);
begin
if active <> new then begin
if new then
UngrayButton(dlg, item)
else
GrayButton(dlg, item);
InitButton(dlg, item, active, new);
end;
end;
end.